package edu.gatech.ors.mrsim.core.impl;

import edu.gatech.ors.mrsim.core.Data;
import edu.gatech.ors.mrsim.core.Event;
import edu.gatech.ors.mrsim.core.Node;

public class IORequest extends Event<Node> {
	private String fileName;
	private Data<?> data;
	private boolean write;
	private String nodeName;

	private IORequest(long timeStamp, Node sourceNode, boolean write, String nodeName, String fileName, Data<?> data) {
		super(timeStamp, sourceNode);
		this.fileName = fileName;
		description = "IO " + (write ? "write" : "read") + " event for data of file " + fileName;
		this.write = write;
		this.data = data;
		this.nodeName = nodeName;
	}

	public IORequest(long timeStamp, Node sourceNode, String nodeName, String fileName, Data<?> data) {
		this(timeStamp, sourceNode, true, nodeName, fileName, data);
	}

	public IORequest(long timeStamp, Node sourceNode, String nodeName, String fileName) {
		this(timeStamp, sourceNode, false, nodeName, fileName, null);
	}

	/**
	 * @return the fileName
	 */
	public String getFileName() {
		return fileName;
	}

	/**
	 * @param fileName
	 *            the fileName to set
	 */
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	/**
	 * @return the data
	 */
	public Data<?> getData() {
		return data;
	}

	/**
	 * @param data
	 *            the data to set
	 */
	public void setData(Data<?> data) {
		this.data = data;
	}

	/**
	 * @return the write
	 */
	public boolean isWrite() {
		return write;
	}

	/**
	 * @return the nodeName
	 */
	public String getNodeName() {
		return nodeName;
	}

}
